package com.htc.dlc.fragment;

import org.apache.http.client.utils.URIUtils;

import com.htc.dlc.R;

import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.Button;
import android.widget.Toast;

public class FragmentAboutContact extends Fragment implements OnClickListener{
	Button send_mail;
	Button call_btn;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_about_contact,
				container, false);
		send_mail = (Button)rootView.findViewById(R.id.send_mail);
		send_mail.setOnClickListener(this);
		call_btn = (Button)rootView.findViewById(R.id.call_btn);
		call_btn.setOnClickListener(this);
		return rootView;
	}
	
	
	private void sendEmail(){
	    Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
	    emailIntent.setData(Uri.parse("mailto:" + "info@dubailadiesclub.com")); 
	    emailIntent.putExtra(Intent.EXTRA_SUBJECT, "your subject");
	    emailIntent.putExtra(Intent.EXTRA_TEXT, "your content...");

	    try {
	        startActivity(Intent.createChooser(emailIntent, "Send email using..."));
	    } catch (android.content.ActivityNotFoundException ex) {
	        Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show();
	    }

	}
	
	private void callPhone(){
		Intent call = new Intent(Intent.ACTION_CALL);
		call.setData(Uri.parse("tel:01683982917"));
		startActivity(call);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		int id = v.getId();
		switch (id) {
		case R.id.send_mail:{
			sendEmail();
		}
			break;
		case R.id.call_btn:{
			callPhone();
		}
		break;
		default:
			break;
		}
		
	}
}
